package cn.iocoder.yudao.module.blog.service.postcomment;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.blog.controller.app.post.commentvo.AppBlogPostCommentPageReqVO;
import cn.iocoder.yudao.module.blog.dal.dataobject.postcomment.BlogPostCommentDO;
import cn.iocoder.yudao.module.blog.dal.mysql.postcomment.BlogPostCommentMapper;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;

import javax.annotation.Resource;

/**
 * 帖子评论 APP Service 实现类
 *
 * @author 曹建伟
 */
@Service
@Validated
public class AppBlogPostCommentServiceImpl implements AppBlogPostCommentService{

    @Resource
    private BlogPostCommentMapper blogPostCommentMapper;

    @Override
    public PageResult<BlogPostCommentDO> getPostCommentPage(AppBlogPostCommentPageReqVO pageReqVO){
        return blogPostCommentMapper.appSelectPage(pageReqVO);
    }

    @Override
    public Long getTotalCount(Long postId){
        return blogPostCommentMapper.selectCount(BlogPostCommentDO::getPostId, postId);
    }
}
